#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

int main()
{
    int pid1, pid2;
    while((pid1 = fork()) == -1);
    if (pid1 == 0)
    {
        lockf(1,1,0);
        printf("child_1 : b\n");
        lockf(1,0,0);
    }
    else
    {
        while ((pid2 = fork()) == -1);
        if (pid2 == 0)
        {
            lockf(1, 1, 0);
            printf("child_2 : c\n");
            lockf(1, 0, 0);
        }
        else 
        {
            lockf(1, 1, 0);
            printf("parent : a\n");
            lockf(1, 0, 0);
        }
    }
    return 0;
}